`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer: 
// 
// Create Date: 2021/05/16 19:17:04
// Design Name: 
// Module Name: cnt_led_code
// Project Name: 
// Target Devices: 
// Tool Versions: 
// Description: 
// 
// Dependencies: 
// 
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// 
//////////////////////////////////////////////////////////////////////////////////


module cnt_led_code(
    input [15:0] actual_num,
    output reg [6:0] digit1_of_num,
    output reg [6:0] digit2_of_num,
    output reg [6:0] digit3_of_num,
    output reg [6:0] digit4_of_num,
    output reg [6:0] digit5_of_num
    );
    parameter ZERO  = 7'b0111111;
    parameter ONE =  7'b0000110;
    parameter TWO  = 7'b1011011;
    parameter THREE =  7'b1001111;
    parameter FOUR = 7'b1100110;
    parameter FIVE = 7'b1101101;
    parameter SIX = 7'b1111101;
    parameter SEVEN = 7'b0100111;
    parameter EIGHT = 7'b1111111;
    parameter NINE = 7'b1100111;
    
    reg [3:0] d1,d2,d3,d4,d5;
    always @(*)begin
        d1 = actual_num/10000;
        d2 = (actual_num % 10000)/1000;
        d3 = (actual_num % 1000)/100; 
        d4 = (actual_num % 100)/10; 
        d5 = actual_num % 10;
    end
    
    always @(*) begin
        case(d1)
            0: digit1_of_num = ZERO;
            1: digit1_of_num = ONE;
            2: digit1_of_num = TWO;
            3: digit1_of_num = THREE;
            4: digit1_of_num = FOUR;
            5: digit1_of_num = FIVE;
            6: digit1_of_num = SIX;
            7: digit1_of_num = SEVEN;
            8: digit1_of_num = EIGHT;
            9: digit1_of_num = NINE;
            default: digit1_of_num = ZERO;
        endcase
        case(d2)
            0: digit2_of_num = ZERO;
            1: digit2_of_num = ONE;
            2: digit2_of_num = TWO;
            3: digit2_of_num = THREE;
            4: digit2_of_num = FOUR;
            5: digit2_of_num = FIVE;
            6: digit2_of_num = SIX;
            7: digit2_of_num = SEVEN;
            8: digit2_of_num = EIGHT;
            9: digit2_of_num = NINE;
            default: digit2_of_num = ZERO;
        endcase
        case(d3)
            0: digit3_of_num = ZERO;
            1: digit3_of_num = ONE;
            2: digit3_of_num = TWO;
            3: digit3_of_num = THREE;
            4: digit3_of_num = FOUR;
            5: digit3_of_num = FIVE;
            6: digit3_of_num = SIX;
            7: digit3_of_num = SEVEN;
            8: digit3_of_num = EIGHT;
            9: digit3_of_num = NINE;
            default: digit3_of_num = ZERO;
        endcase
        case(d4)
            0: digit4_of_num = ZERO;
            1: digit4_of_num = ONE;
            2: digit4_of_num = TWO;
            3: digit4_of_num = THREE;
            4: digit4_of_num = FOUR;
            5: digit4_of_num = FIVE;
            6: digit4_of_num = SIX;
            7: digit4_of_num = SEVEN;
            8: digit4_of_num = EIGHT;
            9: digit4_of_num = NINE;
            default: digit4_of_num = ZERO;
        endcase
        case(d5)
            0: digit5_of_num = ZERO;
            1: digit5_of_num = ONE;
            2: digit5_of_num = TWO;
            3: digit5_of_num = THREE;
            4: digit5_of_num = FOUR;
            5: digit5_of_num = FIVE;
            6: digit5_of_num = SIX;
            7: digit5_of_num = SEVEN;
            8: digit5_of_num = EIGHT;
            9: digit5_of_num = NINE;
            default: digit5_of_num = ZERO;
        endcase
    end
 
endmodule
